package com.sixth.dao;

import com.sixth.entity.Branch;
import com.sixth.entity.Staff;
import com.sixth.util.CommonResult;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface StaffDao {
    int deleteByPrimaryKey(Integer id);

    int insert(Staff record);

    int insertSelective(Staff record);

    Staff selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Staff record);

    int updateByPrimaryKey(Staff record);

    Staff selectByUserameAndPassword(@Param("staffid") Integer staffid, @Param("password") String password);

    /**
     *
     * @param staffname 员工姓名
     * @param staffid 员工id
     * @param branchid 门店id
     * @return
     */
    //查询在职员工
    List<Staff> selectStaffBycondition(@Param("staffname") String staffname, @Param("staffid") Integer staffid, @Param("branchid") Integer branchid);

    /**
     *
     * @param staffname
     * @param staffid
     * @return
     */
    //查询离职员工
    List<Staff> selectStaffBystate(@Param("staffname") String staffname, @Param("staffid")Integer staffid);

    int UpdateState (@Param("state") int state, @Param("id") Integer id, @Param("leavetime") Date date);

    int updateStateDongjie(@Param("state") int state,@Param("id") Integer id);

    int updateStateJieDong(@Param("state") int state,@Param("id") Integer id);

    /**
     *
     * @param staffname
     * @param address
     * @param phone
     * @param id
     * @return
     */
    int updateBycondition(@Param("staffname") String staffname,@Param("address") String address,@Param("phone") String phone,@Param("id")Integer id);

    //添加员工
    int insertStaff(@Param("staffid")Integer staffid,@Param("staffname") String staffname,@Param("password") String password,@Param("idcard") String idcard,@Param("address") String address,@Param("phone") String phone,@Param("entrytime") Date entrytime,@Param("state") Integer state,@Param("roleid") Integer roleid, @Param("url")String url,  @Param("branchid")Integer branchid);

    //修改员工所属分店和部门
    Integer StaffTransfer(@Param("branchid") Integer newbranchid, @Param("deptid") Integer newdeptid, @Param("staffid") Integer staffid);

  //根据staffid查询
    Staff selectByPrimaryStaffid(@Param("staffid") Integer staffid);

    //根据手机号在员工表中查找员工
    Staff selectPhone(String phone);

    //按照员工号查找
    Staff FindStaffid(Integer staffid);

    //根据身份证号查找员工
    Staff getStaffIdcard(@Param("idcard") String Idcard);

    //用id查询员工所有信息
    Staff selectBystaffid(Integer staffid);

    //添加到调动信息
    Integer insertNewStaff(@Param("oldstaffStaffid") Integer oldstaffStaffid, @Param("oldstaffBranchid") Integer oldstaffBranchid, @Param("oldstaffDeptid")Integer oldstaffDeptid, @Param("oldstaffRoleid") Integer oldstaffRoleid, @Param("newbranchid") Integer newbranchid,@Param("newdeptid") Integer newdeptid,@Param("date") Date date,@Param("staffid1") Integer staffid1);

    Staff selectBoos(Integer id);

    //个人信息查全部
    Map selectByStaffid(Integer staffid);

    //修改密码
    int updatePassword(@Param("password") String password,@Param("staffid") Integer staffid);

    List<Map> getStaff();

    List<Staff> getStaffs();

    Staff getStaffById(Integer staffid);

    Integer updateBranchStaff(@Param("staffid") Integer staffid, @Param("branchid") Integer branchid);
}